package com.lenovo.nova.widget;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.widget.EditText;

import com.lenovo.nova.util.Applications;
import com.lenovo.nova.util.Applications.OnInputModeChangeListener;
import com.lenovo.nova.util.debug.slog;
import com.lenovo.nova.util.view.KeyUtil;

public class CustomEditText extends EditText implements OnInputModeChangeListener{

	private static final String TAG = "CustomEditText";

	public CustomEditText(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	public CustomEditText(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	public void onEditorAction(int actionCode) {
		
	}
	
	@Override
	protected void onAttachedToWindow() {
		super.onAttachedToWindow();
		Applications.get(getContext()).addOnInputModeChangeListener(this);
	}
	
	
	@Override
	protected void onDetachedFromWindow() {
		super.onDetachedFromWindow();
		Applications.get(getContext()).removeOnInputChangeListener(this);
	}
	
	@SuppressLint("NewApi")
	@Override
	public void onInputModeChange(boolean isInTouchMode) {
		if(isInTouchMode){
			
		}else{
			if(isHovered()){
				setHovered(false);
			}
		}
	}

}
